<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
                 type="text/css"?>

<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        title="Table header information cells for XUL listbox">

  <script type="application/javascript"
          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />

  <script type="application/javascript"
          src="../common.js"></script>
  <script type="application/javascript"
          src="../table.js"></script>

  <script type="application/javascript">
  <![CDATA[
    function doTest()
    {
      //////////////////////////////////////////////////////////////////////////
      // XUL listbox

      var headerInfoMap = [
        {
          cell: "lb1_cell0",
          rowHeaderCells: [],
          columnHeaderCells: [ "lb1_header1" ]
        },
        {
          cell: "lb1_cell1",
          rowHeaderCells: [],
          columnHeaderCells: [ "lb1_header2" ]
        },
        {
          cell: "lb1_cell2",
          rowHeaderCells: [],
          columnHeaderCells: [ "lb1_header3" ]
        },
        {
          cell: "lb1_cell3",
          rowHeaderCells: [],
          columnHeaderCells: [ "lb1_header1" ]
        },
        {
          cell: "lb1_cell4",
          rowHeaderCells: [],
          columnHeaderCells: [ "lb1_header2" ]
        },
        {
          cell: "lb1_cell5",
          rowHeaderCells: [],
          columnHeaderCells: [ "lb1_header3" ]
        },
      ];

      testHeaderCells(headerInfoMap);

      //////////////////////////////////////////////////////////////////////////
      // XUL listbox with ARIA

      headerInfoMap = [
        {
          cell: "lb2_cell0",
          rowHeaderCells: [],
          columnHeaderCells: []
        },
        {
          cell: "lb2_cell1",
          rowHeaderCells: [],
          columnHeaderCells: []
        },
        {
          cell: "lb2_cell2",
          rowHeaderCells: [],
          columnHeaderCells: []
        },
        {
          cell: "lb2_cell3",
          rowHeaderCells: [],
          columnHeaderCells: [ "lb2_cell0" ]
        },
        {
          cell: "lb2_cell4",
          rowHeaderCells: [ "lb2_cell3" ],
          columnHeaderCells: [ "lb2_cell1" ]
        },
        {
          cell: "lb2_cell5",
          rowHeaderCells: [ "lb2_cell3" ],
          columnHeaderCells: [ "lb2_cell2" ]
        },
        {
          cell: "lb2_cell6",
          rowHeaderCells: [],
          columnHeaderCells: [ "lb2_cell0" ]
        },
        {
          cell: "lb2_cell7",
          rowHeaderCells: [ "lb2_cell6" ],
          columnHeaderCells: [ "lb2_cell1" ]
        },
        {
          cell: "lb2_cell8",
          rowHeaderCells: [ "lb2_cell6" ],
          columnHeaderCells: [ "lb2_cell2" ]
        }
      ];

      testHeaderCells(headerInfoMap);

      SimpleTest.finish();
    }

    SimpleTest.waitForExplicitFinish();
    addA11yLoadEvent(doTest);
  ]]>
  </script>

  <hbox style="overflow: auto;">
  <body xmlns="http://www.w3.org/1999/xhtml">
    <a target="_blank"
       href="https://bugzilla.mozilla.org/show_bug.cgi?id=512424"
       title="implement IAccessibleTable2">
      Mozilla Bug 512424
    </a>

    <p id="display"></p>
    <div id="content" style="display: none">
    </div>
    <pre id="test">
    </pre>
  </body>

  <vbox flex="1">

    <label control="listbox" value="multicolumn listbox with header"/>
    <listbox id="listbox">
      <listhead>
        <listheader id="lb1_header1" label="header1"/>
        <listheader id="lb1_header2" label="header2"/>
        <listheader id="lb1_header3" label="header3"/>
      </listhead>
      <listcols>
        <listcol flex="1"/>
        <listcol flex="1"/>
        <listcol flex="1"/>
      </listcols>
      <listitem>
        <listcell id="lb1_cell0" label="cell0"/>
        <listcell id="lb1_cell1" label="cell1"/>
        <listcell id="lb1_cell2" label="cell2"/>
      </listitem>
      <listitem>
        <listcell id="lb1_cell3" label="cell3"/>
        <listcell id="lb1_cell4" label="cell4"/>
        <listcell id="lb1_cell5" label="cell5"/>
      </listitem>
      <listitem>
        <listcell id="lb1_cell6" label="cell6"/>
        <listcell id="lb1_cell7" label="cell7"/>
        <listcell id="lb1_cell8" label="cell8"/>
      </listitem>
    </listbox>

    <label control="listbox2" value="multicolumn listbox with ARIA headers"/>
    <listbox id="listbox2">
      <listcols>
        <listcol flex="1"/>
        <listcol flex="1"/>
        <listcol flex="1"/>
      </listcols>
      <listitem>
        <listcell role="columnheader" id="lb2_cell0" label="cell0"/>
        <listcell role="columnheader" id="lb2_cell1" label="cell1"/>
        <listcell role="columnheader" id="lb2_cell2" label="cell2"/>
      </listitem>
      <listitem>
        <listcell role="rowheader" id="lb2_cell3" label="cell3"/>
        <listcell id="lb2_cell4" label="cell4"/>
        <listcell id="lb2_cell5" label="cell5"/>
      </listitem>
      <listitem>
        <listcell role="rowheader" id="lb2_cell6" label="cell6"/>
        <listcell id="lb2_cell7" label="cell7"/>
        <listcell id="lb2_cell8" label="cell8"/>
      </listitem>
    </listbox>

  </vbox>
  </hbox>

</window>

